package com.linkedbear.springboot.assemble.c_conditional.config;

import com.linkedbear.springboot.assemble.c_conditional.condition.ExistBossCondition;
import com.linkedbear.springboot.assemble.component.Bar;
import com.linkedbear.springboot.assemble.component.Boss;
import org.springframework.boot.autoconfigure.condition.ConditionalOnBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Conditional;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.DependsOn;

@Configuration
public class BarConfiguration {

    @Bean
    @Conditional(ExistBossCondition.class) // 确保条件正确
//    @ConditionalOnBean()
    // @DependsOn(Boss.class.getName()) 必须是常量
//    @DependsOn("boss")
//    @DependsOn("com.linkedbear.springboot.assemble.component.Boss")
    public Bar bbbar() {
        return new Bar();
    }
}
